//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

package excercise5;
import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;
import ned.IdealChannel;
import ned.DatarateChannel;
import inet.networklayer.autorouting.ipv4.FlatNetworkConfigurator;
import inet.nodes.inet.Router;
import inet.nodes.inet.StandardHost;
import inet.nodes.internetcloud.InternetCloud;
import inet.applications.udpapp.UDPBasicApp;



//
// TODO documentation
//VoIP extension
simple VoIPApp extends UDPBasicApp
{
    @class(VoIPApp); // this means that we want to use our VoIPApp C++ class,
}
network Network
{
    @display("bgb=534,200");
    types:
        channel GateToBack extends DatarateChannel
        {
            delay = 10ms;
            datarate = 10Mbps;
        }
        channel BackToAccess extends DatarateChannel
        {
            delay = 15ms;
            datarate = 2Mbps;
        }
        channel AccessToUser extends DatarateChannel
        {
            delay = 40ms;
            datarate = 64kbps;
        }
        channel InetToGate extends DatarateChannel
        {
            delay = 0ms;
            datarate = 1000000Mbps;
        }

    submodules:
        Gateway: Router {
            @display("p=97,76");
        }
        BackboneRouter[5]: Router {
            @display("p=189,76");
        }
        AccessRouter[25]: Router {
            @display("p=298,76");
        }
        User[625]: StandardHost {
            @display("p=409,76");
        }
        Internet: StandardHost {
            @display("p=31,76");
        }
        iPv4NetworkConfigurator: IPv4NetworkConfigurator {
            @display("p=39,14");
        }
    connections:
        Gateway.pppg++ <--> InetToGate <--> Internet.pppg++;
        for i=0..4 {
            Gateway.pppg++ <--> GateToBack <--> BackboneRouter[i].pppg++;
        }
        for i=0..4, for j=0..4 {
            BackboneRouter[i].pppg++ <--> BackToAccess <--> AccessRouter[i*5+j].pppg++;
        }
        for i=0..24, for j=0..24 {
            AccessRouter[i].pppg++ <--> AccessToUser <--> User[i*25+j].pppg++;
        }
}

